package com.skp.shaphan.menus;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenuItem;

import com.skp.shaphan.ShaphanApp;
import com.skp.shaphan.internalStorage.DBConnector;
import com.skp.shaphan.model.ConnectionDetails;

/**
 * Sets the internal connection as the main connection for querying
 * @author Stephen Phillips
 *
 */
public class DevConnectInternalMenuItem extends JMenuItem implements ActionListener {
	/**
	 * 
	 */
	private static final long serialVersionUID = 7912302846574513812L;

	public DevConnectInternalMenuItem() {
		super("Connection to Internal Storage");
		this.setMnemonic('I');
		this.addActionListener(this);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		ConnectionDetails cd = new ConnectionDetails(DBConnector.getInstance().getConnection(), ConnectionDetails.CONN_TYPE_DERBY);
		ShaphanApp.getMainWindow().getSQLEditorsPane().setConnection(cd);
	}
}
